
////////////////////////////////////////////////////////////////////////////
//	File Name: TMatrixDef.h		Last modification at : 2/20/2003 5:46:49 PM
//	Copyright 1999-2003 Microsoft Corporation. All Rights Reserved.
//
//	Author:      Rong Xiao
//	Email :      t-rxiao@microsoft.com
//
//	Description : 
//
//	Revision History: 
//
////////////////////////////////////////////////////////////////////////////
#pragma once
#ifndef __TMATRIXDEF_H__
#define __TMATRIXDEF_H__

#pragma warning( disable : 4786 )

#define ARRAY_ACCESS_INLINING
//#define USE_WINALLOC

#include <cassert>
#include <fstream>
#include <memory.h>
#include "tfun.h"
#include <vector>
#include <typeinfo.h>

#define LA_EPS 1e-12  //10**(-10)
#define NORMAL_ZERO  1e-12		//~=0,if abs(a-b)<=_ZERO , we think a==b,if abs(a)<=_ZERO ,we think a==0;
#define EXACT_ZERO	1e-16

#ifdef _USE_AFXWIN_
	#include <afxwin.h>
#else
	typedef unsigned char BYTE;
#endif


//#define _USE_AFXWIN_
//#define _FAST_USE_MATLAB		//add by hyx 2001/8/20
//#define	_FAST_USE_OPENCV 
//#define	USING_CLAPACK

#ifdef _FAST_USE_MATLAB
//	#include <matrix.h>
#endif


//#ifdef _FAST_USE_OPENCV
//	#include "cv.h"
//#endif


#ifdef USING_CLAPACK
	#include <clapack.h>
#endif

#define MAT_HEADER_TAG   0x54414D00
#define MAT_HEADER_MASK  0xFFFFFF00   

#define EIGEN_EPS 1E-9

namespace FAST {
template <typename T> class TMatrix;
template <typename T> class TVector;
template <typename T> class TSparseVector;
template <typename T> class TSparseMatrix;
}

typedef FAST::TMatrix<TREAL> TRealMat;
typedef FAST::TMatrix<float> TFloatMat;
typedef FAST::TMatrix<double> TDoubleMat;
typedef FAST::TMatrix<int>  TIntMat;
typedef FAST::TMatrix<unsigned int>  TUIntMat;
typedef FAST::TMatrix<BYTE>  TByteMat;
typedef FAST::TMatrix<char>  TCharMat;

typedef FAST::TVector<TREAL> TRealVect;
typedef FAST::TVector<float> TFloatVect;
typedef FAST::TVector<double> TDoubleVect;
typedef FAST::TVector<int>	TIntVect;
typedef FAST::TVector<unsigned int>	TUIntVect;
typedef FAST::TVector<BYTE>	TByteVect;
typedef FAST::TVector<char>	TCharVect;

typedef FAST::TSparseMatrix<float>	TFloatSparseMat;
typedef FAST::TSparseMatrix<double>	TDoubleSparseMat;
typedef FAST::TSparseMatrix<int>		TIntSparseMat;
typedef FAST::TSparseMatrix<short>	TShortSparseMat;
typedef FAST::TSparseMatrix<char>		TCharSparseMat;
typedef FAST::TSparseMatrix<unsigned int>		TUIntSparseMat;
typedef FAST::TSparseMatrix<unsigned short>	TUShortSparseMat;
typedef FAST::TSparseMatrix<unsigned char>	TByteSparseMat;


typedef FAST::TSparseVector<float>	TFloatSparseVect;
typedef FAST::TSparseVector<double>	TDoubleSparseVect;
typedef FAST::TSparseVector<int>		TIntSparseVect;
typedef FAST::TSparseVector<short>	TShortSparseVect;
typedef FAST::TSparseVector<char>		TCharSparseVect;
typedef FAST::TSparseVector<unsigned int>	TUIntSparseVect;
typedef FAST::TSparseVector<unsigned short>	TUShortSparseVect;
typedef FAST::TSparseVector<unsigned char>	TByteSparseVect;

#endif				 // End of __TMATRIXDEF_H__
